home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / Creator Changer 1.0.3 / Code and Resource / Creator Changer.file.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.9 KB  |  73 lines  |  [TEXT/KAHL]

  1. /**********************************************************************
  2.  *    This file contains the functions which let the user determine 
  3.  *    which file to change the creator and/or file types.
  4.  **********************************************************************/
  5.  
  6. #include "Creator Changer.h"
  7. #include "Creator Changer.file.h"
  8.  
  9.  
  10.  
  11. /**********************************************************************
  12.  *    Function Pick_File(), this function lets the user pick the file
  13.  *    that is to be changed.
  14.  **********************************************************************/
  15.  
  16. int Pick_File(void)
  17.     {
  18.     
  19.         //    If the user did not cancel, get the file information
  20.     if(Old_File(File_Name, &V_Ref_Num))
  21.         {
  22.         GetFInfo(File_Name, V_Ref_Num, &File_Info);
  23.         return(TRUE);
  24.         }
  25.     else return(FALSE);
  26.     
  27.     }
  28.  
  29.  
  30.  
  31. /**********************************************************************
  32.  *    Function Old_File, this function calls the file to have the 
  33.  *    creator and / or file type changed.
  34.  **********************************************************************/
  35.  
  36. int Old_File(Str32 fn, int *v_ref)
  37.     {
  38.     
  39.     static Point SFGwhere={ 90, 82 };    //    where to open the open dialog
  40.     static SFReply reply;
  41.     SFTypeList    my_types;
  42.     
  43.         //    I'm thinking about making a preference file with prefered ...
  44.         //    ... creator and file types in it.  This is, of course, a while
  45.         //  down the road.
  46.     my_types[0]='pref';
  47.     SFGetFile(SFGwhere, "\p", NIL_PTR, -1, my_types, NIL_PTR, &reply);
  48.     if(!reply.good) return(FALSE);
  49.     else
  50.         {
  51.         p_Str_Copy(reply.fName, fn);
  52.         *v_ref=reply.vRefNum;
  53.         return(TRUE);
  54.         }
  55.     
  56.     }
  57.  
  58.  
  59.  
  60. /**********************************************************************
  61.  *    Function p_Str_Copy, this function copies one pascal string to
  62.  *    another pascal string.
  63.  **********************************************************************/
  64.  
  65. void p_Str_Copy(StringPtr p1, StringPtr p2)
  66.     {
  67.     
  68.     register int len;
  69.     
  70.     len=*p2++=*p1++;
  71.     while(--len>=0) *p2++=*p1++;
  72.     
  73.     }